#include "Thread.h"

Thread::Thread() :
		running(false) {
	mutex = NULL;
}

void Thread::start() {
	running = true;
	pthread_create(&t, 0, callback, this);
}

void Thread::stop() {
	running = false;
}

void Thread::join() {
	void *p;
	pthread_join(t, &p);
}

Thread::~Thread() {
}

bool Thread::isRunning() {
	return running;
}

//Thread::Thread(const Thread& c) {
//}



void Thread::sleepThread(unsigned int seconds){
	sleep(seconds);
}

void Thread::setMorir(bool morir){
	this->morir = morir;
}

bool Thread::getMorir(){
	return this->morir;
}

Mutex & Thread::getMutex(){
	return *this->mutex;
}

void Thread::cancel() {
	pthread_cancel(t);
}
